import request from '@/utils/request';

// 查询生产计划列表
export function listPlanning(query) {
  return request({
    url: '/mes/pro/planning/list',
    method: 'get',
    params: query
  });
}

// 查询生产计划详细
export function getPlanning(planId) {
  return request({
    url: '/mes/pro/planning/' + planId,
    method: 'get'
  });
}

// 新增生产计划
export function addPlanning(data) {
  return request({
    url: '/mes/pro/planning',
    method: 'post',
    data: data
  });
}

// 修改生产计划
export function updatePlanning(data) {
  return request({
    url: '/mes/pro/planning',
    method: 'put',
    data: data
  });
}

// 修改生产计划
export function savePlanning(data) {
  return request({
    url: '/mes/pro/planning/save',
    method: 'put',
    data: data
  });
}

// 删除生产计划
export function delPlanning(planId) {
  return request({
    url: '/mes/pro/planning/' + planId,
    method: 'delete'
  });
}

// 分解生产计划
export function fenjiePlanning(planId) {
  return request({
    url: '/mes/pro/planning/fenjie?planId=' + planId,
    method: 'get'
  });
}

// 查询生产计划列表
export function listPlanningDemand(query) {
  return request({
    url: '/mes/pro/planning/demand',
    method: 'get',
    params: query
  });
}

// 计划执行明细表
export function listJhzxmx(query) {
  return request({
    url: '/mes/pro/planning/jhzxmx',
    method: 'get',
    params: query
  });
}

// 计划执行汇总表
export function listJhzxhz(query) {
  return request({
    url: '/mes/pro/planning/jhzxhz',
    method: 'get',
    params: query
  });
}

// 中止
export function died(data) {
  return request({
    url: '/mes/pro/planning/died',
    method: 'put',
    data: data
  })
}

// 中止
export function restart(data) {
  return request({
    url: '/mes/pro/planning/restart',
    method: 'put',
    data: data
  })
}

// 分解生产计划
export function fenjiePlanning2(planId) {
  return request({
    url: '/mes/pro/planning/fenjie2?planId=' + planId,
    method: 'get'
  });
}
